package 算法.jt;

import org.junit.Test;

/**
 * @author lchenglong
 * @date 2020/12/12
 */
public class StaticProxyTest {
    @Test
    public void test(){
        CountImpl count = new CountImpl();
        CountProxyForStatic countProxyForStatic = new CountProxyForStatic(count);
        countProxyForStatic.get();
        countProxyForStatic.set();
    }


    @Test
    public void testDynamic() {
        CountProxyForDynamic proxy = new CountProxyForDynamic();
        Count count = (Count) proxy.bind(new CountImpl());
        count.get();
    }

    @Test
    public void testCglib() {
        CountProxyForCglib proxy = new CountProxyForCglib();
        CountNoImpl cglibInstance = (CountNoImpl)proxy.getInstance(new CountNoImpl());
        cglibInstance.set();

    }

    @Test
    public void testNum(){
        double result = log(10,100000000);
        System.out.println(result);
        System.out.println(new Double(Math.pow(2,32)).intValue());
        System.out.println(Integer.MAX_VALUE);
        System.out.println(2.3*1.3);
    }



    public static double log(int basement, int n){
        return Math.log(n) / Math.log(basement);
    }

}
